package com.xf.system.response;

import java.util.Objects;

/**
 * @author xiefengf
 * 自定义返回code+返回信息
 */
public class CodeAndMessage {

    /**
     * 自定义code
     */
    private final Integer code;

    /**
     * 自定义信息
     */
    private final String message;

    public CodeAndMessage(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CodeAndMessage that = (CodeAndMessage) o;
        return Objects.equals(code, that.code) && Objects.equals(message, that.message);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, message);
    }

    @Override
    public String toString() {
        return "CodeAndMessage{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }

}
